< previous page page_179 next page >

Page 179
0179-01.jpg
Figure 6.7
Increasing contrast too much creates large discontinuities  in the image's colors.
e10a6a0a59f035e870d90cca05b85fce.gif
' Clear the previous results.
For i = 0 To 2
    picHistogram(i).Cls
    picHistogram(i).Refresh
Next i

' Get the pixels from picImage.
GetBitmapPixels picImage, pixels, bits_per_pixel

' Count the brightness values.
For Y = 0 To picImage.ScaleHeight - 1
    For X = 0 To picImage.ScaleWidth - 1
        With pixels(X, Y)
            counts(0, .rgbRed) = _
                counts(0, .rgbRed) + 1
            counts(1, .rgbGreen) = _
                counts(1, .rgbGreen) + 1
            counts(2, .rgbBlue) = _
                counts(2, .rgbBlue) + 1
        End With
    Next X
Next Y

' Find the largest count value.
For i = 0 To 2
    ' Skip value 0. There tend to be a lot of
    ' them and they dominate things.

 
< previous page page_179 next page >